﻿using Models;
using MovieMS_JW4;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Car
{
    public class CartItemDAL
    {
        public static List<CartItem> selectID(int GoodsID)
        {
            string sql =string.Format("select * from Goods where GoodsID={0}",GoodsID);
            List<CartItem> list = new List<CartItem>();
            SqlDataReader dr = DBHelperSQL.GetDataReader(sql);
            while (dr.Read())
            {
                CartItem gd = new CartItem();
                gd.GoodsName = dr["GoodsName"].ToString();
                gd.GoodsPrice = decimal.Parse(dr["GoodsPrice"].ToString());
               
                gd.GoodsPic = dr["GoodsPic"].ToString();
                list.Add(gd);
            }
            dr.Close();
            return list;
        }
    }
}
